fix: prevent apply_diff from hanging on large/complex XML files #6030
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes issue #4852 where
apply_diffwould hang indefinitely on large or complex XML files with concurrent edits enabled.Problem
The
apply_diffoperation was hanging when processing large XML files with:Solution
Performance Optimizations:
fuzzySearchwhen exact matches are foundTimeout Mechanism:
Integration Tests:
Testing
Performance Impact
The optimizations significantly improve performance:
Fixes #4852
Important
Fixes hanging issue in
apply_difffor large XML files by adding performance optimizations and a timeout mechanism, with comprehensive tests to ensure reliability.apply_difffor large XML files with deep nesting, repeating patterns, and ambiguous content.applyDiff()inmulti-file-search-replace.tsandmulti-search-replace.ts.fuzzySearchfor exact matches inmulti-file-search-replace.tsandmulti-search-replace.ts.fuzzySearchto prevent infinite loops.multi-search-replace-hanging.spec.tsandmulti-search-replace-performance.spec.tsto verify performance and prevent hanging.This description was created by
for 2410003. You can customize this summary. It will automatically update as commits are pushed.